{%- assign author = page.author | default: page.authors[0] | default: site.author -%}
{%- assign author = site.data.authors[author] | default: author -%}

<div class="page-author h-card p-author">
  {%- if author.picture -%}
    {%- if author.picture contains "://" -%}
      {%- assign author_picture = author.picture -%}
    {%- else -%}
      {%- assign author_picture = author.picture | relative_url -%}
    {%- endif -%}
    <img src="{{ author_picture }}" class="author-avatar u-photo" alt="{{ author.name }}">
  {%- endif -%}

  <div class="author-info">
    {%- if author.name -%}
      <div class="author-name">
        {% if site.data.text[site.locale].by %}<em>{{ site.data.text[site.locale].by }}</em> {% endif %}<span class="p-name">{{ author.name }}</span>
      </div>
    {%- endif -%}
    {%- if author.links -%}
      <ul class="author-links">
        {%- for link in author.links -%}
          {%- if link.url contains "://" -%}
            {%- assign url = link.url -%}
          {%- else -%}
            {%- assign url = link.url | relative_url -%}
          {%- endif -%}
          <li class="author-link">
            <a class="u-url" rel="me" href="{{ url }}"><i class="{{ link.icon | default : 'fas fa-link' }} fa-lg" title="{{ link.title }}"></i></a>
          </li>
        {%- endfor -%}
      </ul>
    {%- endif -%}
    {% if site.read_time %}{% include read-time.html %}{% endif %}
    {% if page.date %}{% include page-date.html %}{% endif %}
  </div>
</div>
